package o;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

public class dnd {
    private static dng ʽ;
    private static b ᐝ = new b();
    private SimpleDateFormat ʼ = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.US);
    String ˊ = "ECS";
    dne ˋ = null;
    long ˎ = 0;
    long ˏ = 0;
    String ॱ = null;
    StringBuilder ॱॱ = null;

    public static class b extends dnl {
        private BlockingQueue<dnd> ˎ = new LinkedBlockingQueue();

        public b() {
            super("logger");
        }

        public void ॱ(dnd o_dnd) {
            if (!this.ˎ.offer(o_dnd)) {
                dnp.ॱ("Logger", "offer Logger to BlockingQueue failed!");
            }
        }

        protected boolean ˊ() {
            return true;
        }

        protected boolean ˎ() {
            try {
                if (dnd.ˎ() != null) {
                    dnd o_dnd = (dnd) this.ˎ.poll(3, TimeUnit.SECONDS);
                    if (!dnd.ˋ(o_dnd)) {
                        o_dnd.ॱॱ();
                    } else if (o_dnd != null) {
                        return false;
                    }
                }
                Thread.sleep(1000);
                return true;
            } catch (InterruptedException e) {
                return true;
            }
        }

        protected void ˋ() {
        }
    }

    private dnd() {
    }

    private dnd(String str, dne o_dne) {
        this.ˊ = str;
        this.ˋ = o_dne;
    }

    public static String ॱ(boolean z) {
        return "";
    }

    public static void ˏ() {
        if (!ᐝ.isAlive()) {
            ᐝ.start();
        }
    }

    public static boolean ˋ(dnd o_dnd) {
        return o_dnd == null || o_dnd.ʻ();
    }

    public static synchronized dng ˎ() {
        dng o_dng;
        synchronized (dnd.class) {
            o_dng = ʽ;
        }
        return o_dng;
    }

    public static synchronized void ॱ(dng o_dng) {
        synchronized (dnd.class) {
            ˏ();
            ʽ = o_dng;
        }
    }

    public static synchronized void ˊ(String str) {
        synchronized (dnd.class) {
            ˊ(ʽ);
            if (ʽ != null) {
                ʽ.ˏ(str);
            }
        }
    }

    public static boolean ˋ(String str) {
        return ॱ(str, dne.DEBUG);
    }

    public static dnd ˎ(String str) {
        return ˎ(str, dne.DEBUG);
    }

    public static void ॱ(String str, String str2) {
        if (ˋ(str)) {
            ˎ(str, dne.DEBUG).ॱ((Object) str2).ʽ();
        }
    }

    public static dnd ˋ() {
        return ˎ(null, dne.INFO);
    }

    public static dnd ॱ(String str) {
        return ˎ(str, dne.INFO);
    }

    public static dnd ˏ(String str) {
        return ˎ(str, dne.WARN);
    }

    public static dnd ˊ() {
        return ˎ(null, dne.ERROR);
    }

    public static dnd ʼ(String str) {
        return ˎ(str, dne.ERROR);
    }

    public static dnd ˎ(String str, dne o_dne) {
        if (str == null) {
            str = "ECS";
        }
        dnd o_dnd = new dnd(str, o_dne);
        if (o_dnd.ॱˊ()) {
            o_dnd.ˎ = System.currentTimeMillis();
            Thread currentThread = Thread.currentThread();
            o_dnd.ˏ = currentThread.getId();
            o_dnd.ॱ = currentThread.getName();
            o_dnd.ॱॱ = new StringBuilder(32);
        }
        return o_dnd;
    }

    public static boolean ॱ(String str, dne o_dne) {
        dng ˎ = ˎ();
        if (ˎ == null) {
            return true;
        }
        if (str == null) {
            str = "ECS";
        }
        return ˎ.ˋ(str, o_dne);
    }

    public static void ॱ(dne o_dne) {
        dng ˎ = ˎ();
        ˊ(ˎ);
        ˎ.ˏ(o_dne);
    }

    private static void ˊ(dng o_dng) {
        if (o_dng == null) {
            throw new NullPointerException("loggerImpl_ is null, should call setLogger() first.");
        }
    }

    public static String ॱ() {
        dng ˎ = ˎ();
        if (ˎ == null) {
            return null;
        }
        return ˎ.ˊ();
    }

    public static String ˋ(Throwable th) {
        if (th == null) {
            return "";
        }
        Writer stringWriter = new StringWriter();
        th.printStackTrace(new PrintWriter(stringWriter));
        return stringWriter.toString();
    }

    public static boolean ᐝ() {
        dng ˎ = ˎ();
        return ˎ != null ? ˎ.ॱ() : false;
    }

    public static void ˏ(boolean z) {
        dng ˎ = ˎ();
        if (ˎ != null) {
            ˎ.ˊ(z);
        }
    }

    public boolean ʻ() {
        return this.ॱॱ == null;
    }

    public <T> dnd ॱ(T t) {
        if (ॱˊ()) {
            ˏ((Object) t);
        }
        return this;
    }

    public dnd ॱ(Throwable th) {
        if (ॱˊ()) {
            ˏ(Character.valueOf('\n')).ˏ(ˋ(th));
        }
        return this;
    }

    private <T> dnd ˏ(T t) {
        this.ॱॱ.append(t);
        return this;
    }

    public void ʽ() {
        if (this.ॱॱ != null) {
            ᐝ.ॱ(this);
        }
    }

    void ॱॱ() {
        dng ˎ = ˎ();
        if (ˎ != null) {
            ˎ.ॱ(this);
        }
    }

    private boolean ॱˊ() {
        return ॱ(this.ˊ, this.ˋ);
    }

    public dmx ˊ(dmx o_dmx) {
        o_dmx.ˏ(this.ʼ.format(Long.valueOf(this.ˎ)));
        o_dmx.ˏ(Character.valueOf('[')).ˏ(this.ˊ).ˏ(Character.valueOf(']'));
        o_dmx.ˏ(Character.valueOf('[')).ˏ(this.ˋ).ˏ(Character.valueOf(']'));
        return o_dmx;
    }

    public dmx ˋ(dmx o_dmx) {
        String ॱ = ॱ();
        if (ॱ != null && ॱ.length() > 0) {
            o_dmx.ˏ(Character.valueOf('[')).ˏ(ॱ).ˏ(Character.valueOf(']'));
        }
        o_dmx.ˏ(this.ॱ).ˏ(Character.valueOf('{')).ˏ(Long.valueOf(this.ˏ)).ˏ(Character.valueOf('}'));
        if (this.ˋ == dne.ASSERT || this.ˋ == dne.ERROR || this.ˋ == dne.WARN) {
            o_dmx.ˏ(" <<< ").ˏ(this.ˋ).ˏ(" >>>");
        }
        o_dmx.ˏ(Character.valueOf(' ')).ˏ(this.ॱॱ.toString());
        return o_dmx;
    }

    public String ʼ() {
        dmx ˊ = dmx.ˊ();
        ˊ(ˊ);
        return ˊ.ˎ();
    }

    public String ˏॱ() {
        dmx ˊ = dmx.ˊ();
        ˋ(ˊ);
        return ˊ.ˎ();
    }

    public String toString() {
        dmx ˊ = dmx.ˊ();
        ˊ(ˊ);
        ˋ(ˊ);
        return ˊ.ˎ();
    }
}
